package com.mz.mattress.client.service;

import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
import com.mz.mattress.api.common.Result;
import com.mz.mattress.api.req.PrepayWxReq;

public interface PayService {

    String bodyKey = "店铺订单";
    String REQUEST_ID = "1";
    String SUCCESS = "SUCCESS";

    String FEE_TYPE = "CNY";

    /**
     * 预支付
     * @return 生成 返回给微信的参数
     * <p>
     * {
     * "respData":"{\"timeStamp\":\"1596073887\",\"package\":\"prepay_id=wx30095127777480d752491e891703435100\",\"paySign\":\"ULW6RJ5njivWT2Nu6B28HRB9v/XbPYfxKp/1WRTeJQsLndYEofTuGwj6GZXiQiQLIh/OtOGpdRktExsvPVTUTithsX92SrqJMG3KzBsQsQ6arwm31T6U6O44uD/s8ySibWsXQWuxYcQ9eylYKaM8/zHqq5PU/fntXZkU8CiVF14boJn39fyWuLIoK3n2NOZzMHDoM5r3znMuSDaf8KB5JQ1SPVYe+V2eWkbDovapZej/MnzyfzacMMC9SI5k9X3CtozPbJD6C0+l3XwPnCAO4+KJT+Gl/IAGFohyTHthBY8NmIiJSQg3Lq/GUzQMGW2bDVaNEdB7kHUAcwTu3MMA6A==\",\"appId\":\"wxf4bf21e33102faa6\",\"signType\":\"RSA\",\"nonceStr\":\"65c2cc64f30e42ffa59d1a00148e649a\"}",
     * "respMsg":"交易受理成功，请尽快发起交易支付",
     * "txnOrderId":"2005233000123",
     * "respCode":"0000",
     * "respTxnSsn":"82020073009505046680672819283062",
     * "respTxnTime":"20200730095050"
     * }
     */
    Result<Object> prepay(PrepayWxReq req);

    /**
     * 订单是否已支付
     * @param orderId
     * @param outTradeNo     可为空
     * @return 1已支付 0未支付
     */
    Result<Integer> queryIsPaid(Long orderId, String outTradeNo);

    /**
     * 执行退款
     * @param orderId
     * @param money
     * @return
     */
    Result doRefundMoney(Long orderId, Integer money);

    void payNotify(WxPayOrderNotifyResult result, String orderId);

    void refundNotify(WxPayRefundNotifyResult result, String orderId);

}
